﻿<Window x:Class="Snip.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:Snip"
        Title="Snip" SizeToContent="WidthAndHeight" ResizeMode="CanMinimize" UseLayoutRounding="True" TextOptions.TextFormattingMode="Display">

    <Window.Resources>
        <BitmapImage x:Key="Icon" UriSource="./Images/Snip.png" />
        <local:IntervalConverter x:Key="IntervalConverter" />
        <local:NotConverter x:Key="NotConverter" />
    </Window.Resources>

    <Grid Grid.IsSharedSizeScope="True">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>

        <Grid Margin="15">
            <Grid.ColumnDefinitions>
                <ColumnDefinition SharedSizeGroup="Column1" Width="90"  />
                <ColumnDefinition SharedSizeGroup="Column2" Width="280" />
                <ColumnDefinition SharedSizeGroup="Column3" Width="85" />
            </Grid.ColumnDefinitions>

            <Image Source="{StaticResource Icon}" Width="64" Height="64" HorizontalAlignment="Center" VerticalAlignment="Center" />
            <StackPanel Grid.Column="1" Grid.ColumnSpan="2" Margin="0,0,0,0">
                <TextBlock FontSize="16" FontWeight="Bold">Snip</TextBlock>
                <TextBlock x:Name="DescriptionTextBlock" VerticalAlignment="Center" TextWrapping="Wrap" Margin="0,0,10,0">
                    Splits <Span FontStyle="Italic">World of Warcraft</Span> combat log file by a specified time interval. For more information, visit: <Hyperlink NavigateUri="http://snip.codeplex.com" RequestNavigate="Hyperlink_RequestNavigate">http://snip.codeplex.com</Hyperlink>.
                </TextBlock>
            </StackPanel>
        </Grid>

        <Grid Grid.Row="1" Margin="15,0">
            <Grid.RowDefinitions>
                <RowDefinition SharedSizeGroup="Row" Height="28" />
                <RowDefinition  />
                <RowDefinition SharedSizeGroup="Row" />
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition SharedSizeGroup="Column1" />
                <ColumnDefinition SharedSizeGroup="Column2" />
                <ColumnDefinition SharedSizeGroup="Column3" />
            </Grid.ColumnDefinitions>

            <Label Content="Source file:" VerticalAlignment="Center" />
            <TextBox x:Name="SourceFileTextBox" Text="{Binding Path=SourceFile, RelativeSource={RelativeSource AncestorType=Window}, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" Grid.Column="1" />
            <Button x:Name="BrowseFileButton" Content="Browse..." Grid.Column="2" Width="75" Click="BrowseFileButton_Click" VerticalAlignment="Center" Margin="5,0" />

            <Label Content="Split interval:" Grid.Row="2" />
            <ComboBox x:Name="IntervalComboBox" Grid.Row="2" Grid.Column="1" Width="120" HorizontalAlignment="Left" VerticalAlignment="Center" SelectedItem="{Binding Path=Interval}">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Path=., Converter={StaticResource IntervalConverter}}" />
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
        </Grid>

        <Border x:Name="DetailsBorder" Grid.Row="2" Margin="15,0">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition SharedSizeGroup="Row" />
                    <RowDefinition SharedSizeGroup="Row" />
                    <RowDefinition SharedSizeGroup="Row" />
                    <RowDefinition SharedSizeGroup="Row" />
                    <RowDefinition SharedSizeGroup="Row" />
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition SharedSizeGroup="Column1" />
                    <ColumnDefinition SharedSizeGroup="Column2" />
                    <ColumnDefinition SharedSizeGroup="Column3" />
                </Grid.ColumnDefinitions>

                <Label Content="Save in: " />
                <CheckBox IsChecked="{Binding Path=SaveInSameFolderAsSourceFile}" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,0,0,0">Same folder as the source file</CheckBox>
                <TextBox x:Name="DestFolderTextBox" Grid.Row="1" Grid.Column="1" Text="{Binding Path=DestFolder, UpdateSourceTrigger=PropertyChanged}" Height="21" ToolTip="Leave this field empty to save in the same location of the source file." IsEnabled="{Binding Path=SaveInSameFolderAsSourceFile, Converter={StaticResource NotConverter}}" />
                <Button x:Name="BrowseFolderButton" Content="Browse..." Grid.Row="1" Grid.Column="2" Width="75" VerticalAlignment="Center" Margin="5,0" IsEnabled="{Binding Path=SaveInSameFolderAsSourceFile, Converter={StaticResource NotConverter}}" />

                <CheckBox IsChecked="{Binding Path=CreateSubFolders}" Grid.Row="2" Grid.ColumnSpan="3" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,0,0,0">Create subfolders for year and month</CheckBox>
                <CheckBox IsChecked="{Binding Path=DeleteSourceFileOnComplete}" Grid.Row="3" Grid.ColumnSpan="3" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,0,0,0">Delete the source file when done</CheckBox>
                <CheckBox IsChecked="{Binding Path=OpenDestFolderOnComplete}" Grid.Row="4" Grid.ColumnSpan="3" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,0,0,0">Open the destination folder when done</CheckBox>
            </Grid>
        </Border>

        <Border Grid.Row="3" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" BorderThickness="0,1,0,0" BorderBrush="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}" Margin="0,15,0,0">
            <Grid Margin="15,7">
                <Expander x:Name="OptionsExpanderDummy" Header="Options(_O)" Expanded="OptionsExpanderDummy_Expanded" Collapsed="OptionsExpanderDummy_Collapsed" HorizontalAlignment="Left" />
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                    <Button x:Name="SplitButton" Content="Split(_S)" Width="100" Height="21" VerticalAlignment="Top" HorizontalAlignment="Right" Click="SplitButton_Click" />
                    <Button x:Name="CloseButton" Content="Close" Width="100"  Height="21" Margin="5,0,0,0" Click="CloseButton_Click" />
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</Window>
